{extend name="adminblue/base" /}
{block name="resources"/}
<style>
.ns-main{margin-top:0px;}
</style>
{/block}
{block name="main"}
<div class="set-style">
	<h4>网站基础设置</h4>
	<dl>
		<dt>网站名称：</dt>
		<dd>
			<input id="title" type="text" value="{$website.title}" class="input-common" />
		</dd>
	</dl>
	<dl>
		<dt>官方网址：</dt>
		<dd>
			<input id="web_url" type="text" value="{$website.web_url}" class="input-common" />
		</dd>
	</dl>
	<dl>
		<dt>网站关键字：</dt>
		<dd>
			<p>
				<input id="key_words" type="text" value="{$website.key_words}" class="input-common long" />
			</p>
			<p class="hint">用于网站搜索引擎的优化，关键字之间请用英文逗号分隔</p>
		</dd>
	</dl>
	<dl>
		<dt>网站描述：</dt>
		<dd>
			<textarea name="store_zy" rows="2" id="web_desc" class="textarea-common" >{$website.web_desc}</textarea>
			<p class="hint">关键字最多可输入50字，请用","进行分隔，例如”男装,女装,童装”</p>
		</dd>
	</dl>
	<dl>
		<dt>网站弹出框标题：</dt>
		<dd>
			<p>
				<input id="web_popup_title" type="text" value="{$website.web_popup_title}" class="input-common" maxlength="15">
			</p>
			<p class="hint">网站弹出框标题，最大不超过15个字符</p>
		</dd>
	</dl>
	<dl>
		<dt>网站logo：</dt>
		<dd>
			<div class="upload-btn-common">
				<div>
					<input class="input-file" name="file_upload" id="uploadImg" type="file" onchange="imgUpload(this);" title="上传">
					<input type="hidden" id="logo" value="{if condition="$website.logo"}{$website.logo}{/if}" />
				</div>
				<input type="text" id="text_logo" class="input-common" readonly="readonly" value="{if condition="$website.logo"}{$website.logo}{/if}" />
				<em>上传</em>
				
				<img id="preview_logo" src="__STATIC__/blue/img/upload-common-select.png" {if condition="$website.logo"}data-src="{:__IMG($website.logo)}"{/if} data-html="true" data-container="body" data-placement="top" data-trigger="manual"/>

			</div>
			<p class="hint">
				<span>建议使用<i class="important-note">宽280</i>像素-<i class="important-note">高50</i>像素内的<i class="important-note">GIF</i>或<i class="important-note">PNG</i>透明图片</span>
			</p>
		</dd>
	</dl>
	<dl>
		<dt>网站微信分享logo：</dt>
		<dd>
			
			<div class="upload-btn-common">
				<div>
					<input class="input-file" name="file_upload" id="uploadImgwechat_share_logo" type="file" onchange="imgUpload(this);" title="上传">
					<input type="hidden" id="wechat_share_logo" value="{if condition="$website.web_wechat_share_logo"}{$website.web_wechat_share_logo}{/if}" />
				</div>
				<input type="text" id="text_wechat_share_logo" class="input-common" readonly="readonly" value="{if condition="$website.web_wechat_share_logo"}{$website.web_wechat_share_logo}{/if}" />
				<em>上传</em>
				
				<img id="preview_wechat_share_logo" src="__STATIC__/blue/img/upload-common-select.png" {if condition="$website.web_wechat_share_logo"}data-src="{:__IMG($website.web_wechat_share_logo)}"{/if} data-html="true" data-container="body" data-placement="top" data-trigger="manual"/>

			</div>
			<p class="hint">
				<span>建议使用<i class="important-note">宽80</i>像素-<i class="important-note">高80</i>像素内的正方形图片</span>
			</p>
		</dd>
	</dl>
	<dl>
		<dt>网站二维码：</dt>
		<dd>
			<div class="upload-btn-common">
				<input type="text" id="text_qrcode_path" class="input-common" readonly="readonly" value="{$qrcode_path}">
				<img id="preview_qrcode_path" style="margin:0;" src="__STATIC__/blue/img/upload-common-select.png" data-src="{:__IMG($qrcode_path)}" data-html="true" data-container="body" data-placement="top" data-trigger="manual"/>
			</div>
		</dd>
	</dl>
	
	<dl>
		<dt>网站公众号二维码：</dt>
		<dd>
			
			<div class="upload-btn-common">
				<div>
					<input class="input-file" name="file_upload" id="uploadImgweb_qrcode" type="file" onchange="imgUpload(this);" title="上传">
					<input type="hidden" id="web_qrcode" value="{if condition="$website.web_qrcode"}{$website.web_qrcode}{/if}" />
				</div>
				<input type="text" id="text_web_qrcode" class="input-common" readonly="readonly" value="{if condition="$website.web_qrcode"}{$website.web_qrcode}{/if}" />
				<em>上传</em>
				
				<img id="preview_web_qrcode" src="__STATIC__/blue/img/upload-common-select.png" {if condition="$website.web_qrcode"}data-src="{:__IMG($website.web_qrcode)}"{/if} data-html="true" data-container="body" data-placement="top" data-trigger="manual"/>

			</div>
			
			<p class="hint">
				<span>建议使用<i class="important-note">宽100</i>像素-<i class="important-note">高100</i>像素内的<i class="important-note">GIF</i>或<i class="important-note">PNG</i>透明图片</span>
			</p>
			
		</dd>
	</dl>
	<h4>网站联系设置</h4>
	<dl>
		<dt>网站联系方式：</dt>
		<dd>
			<p>
				<input id="web_phone" type="text" value="{$website.web_phone}" class="input-common" />
			</p>
		</dd>
	</dl>
	<dl>
		<dt>网站邮箱：</dt>
		<dd>
			<p>
				<input id="web_email" type="text" value="{$website.web_email}" class="input-common" />
			</p>
		</dd>
	</dl>
	
	<dl>
		<dt>网站QQ号：</dt>
		<dd>
			<p>
				<input id="web_qq" type="text" value="{$website.web_qq}" class="input-common" />
			</p>
		</dd>
	</dl>
	<dl>
		<dt>网站微信号：</dt>
		<dd>
			<p>
				<input id="web_weixin" type="text" value="{$website.web_weixin}" class="input-common" />
			</p>
		</dd>
	</dl>
	<dl>
		<dt>联系地址：</dt>
		<dd>
			<input id="web_address" type="text" value="{$website.web_address}" class="input-common long" />
		</dd>
	</dl>
	<h4>备案与统计设置</h4>
	<dl>
		<dt>网站ICP备案号：</dt>
		<dd>
			<p>
				<input id="web_icp" type="text" value="{$website.web_icp}" class="input-common" />
			</p>
		</dd>
	</dl>
	<dl>
		<dt>网站公安备案：</dt>
		<dd>
			<p>
				<input id="web_gov_record" type="text" value="{$website.web_gov_record}" class="input-common" maxlength="30"/>				
			</p>
		</dd>
	</dl>
	<dl>
		<dt>网站公安备案链接：</dt>
		<dd>
			<p>
				<input id="web_gov_record_url" type="text" value="{$website.web_gov_record_url}" class="input-common" maxlength="200"/>		
			</p>
		</dd>
	</dl>
	<dl>
		<dt>商城第三方统计代码：</dt>
		<dd>
			<textarea name="store_zy" rows="2" id="third_count" class="textarea-common">{$website.third_count}</textarea>
			<p class="hint">页面底部可以显示第三方统计</p>
		</dd>
	</dl>
	
	<dl>
		<dt></dt>
		<dd><button class="btn-common btn-big" onclick="setConfigAjax();">保存</button></dd>
	</dl>
</div>
<script src="__STATIC__/js/ajax_file_upload.js" type="text/javascript"></script>
<script src="__STATIC__/js/file_upload.js" type="text/javascript"></script>
<script>
//图片上传
function imgUpload(event) {
	var fileid = $(event).attr("id");
	var data = { 'file_path' : UPLOADCOMMON };
	var id = $(event).next().attr("id");
	uploadFile(fileid,data,function(res){
		if(res.code){
			$("#"+id).val(res.data);
			$("#text_" + id).val(res.data);
			$("#preview_" + id).attr("data-src",__IMG(res.data));
			showTip(res.message,"success");
		}else{
			showTip(res.message,"error");
		}
	});
}

function setConfigAjax() {
	var title = $("#title").val();
	var web_url = $("#web_url").val();
	var key_words = $("#key_words").val();
	var web_desc = $("#web_desc").val();
	var web_popup_title = $("#web_popup_title").val();
	var Logo = $("#logo").val();
	var web_wechat_share_logo = $("#wechat_share_logo").val();//网站微信分享logo
	var web_qrcode = $("#web_qrcode").val();
	var web_phone = $("#web_phone").val();
	var web_email = $("#web_email").val();
	var web_qq = $("#web_qq").val();
	var web_weixin = $("#web_weixin").val();
	var web_address = $("#web_address").val();
	var web_icp = $("#web_icp").val();
	var third_count = $("#third_count").val();
	
	var web_gov_record = $("#web_gov_record").val();
	var web_gov_record_url = $("#web_gov_record_url").val();
	
	$.ajax({
		type : "post",
		url : "{:__URL('ADMIN_MAIN/config/webconfig')}",
		data : {
			'title' : title,
			'web_url' : web_url,
			'web_address' : web_address,
			'web_desc' : web_desc,
			'logo' : Logo,
			'web_qrcode' : web_qrcode,
			'key_words' : key_words,
			'web_phone' : web_phone,
			'web_email' : web_email,
			'web_qq' : web_qq,
			'web_weixin' : web_weixin,
			'web_icp' : web_icp,
// 			'web_style_pc' : web_style_pc,
			'third_count' : third_count,
			'web_popup_title' : web_popup_title,
			'web_wechat_share_logo' : web_wechat_share_logo,
			'web_gov_record' : web_gov_record,
			'web_gov_record_url' : web_gov_record_url
		},
		success : function(data) {
			if (data["code"] > 0) {
				showTip(data["message"],"success");
				window.location.href = "{:__URL('ADMIN_MAIN/config/webconfig')}";
			} else {
				showTip(res.message,"error");
			}
		}
	});
}
</script>
{/block}